package Client;

import Const.ClientConst;
import java.io.Serializable;

/**
 *
 * Class description goes here.
 *
 * @author Kamil Gajowy
 */
public class Client implements Serializable {

    private int state;
    private boolean clientRunning = false;
    private int currentFloor;
    private int clientCurrentFloor;
    private int desiredFloor;
    private int desiredDirection;
    private long arriveTime;
    private long enterTime;

    private int port;
    private String host;
    private int id;

    /**
     * For serialization only!
     */
    public Client() {

    }

    /**
     * Get the value of clientCurrentFloor
     *
     * @return the value of clientCurrentFloor
     */
    public int getClientCurrentFloor() {
        return clientCurrentFloor;
    }

    /**
     * Set the value of clientCurrentFloor
     *
     * @param clientCurrentFloor new value of clientCurrentFloor
     */
    public void setClientCurrentFloor(int clientCurrentFloor) {
        this.clientCurrentFloor = clientCurrentFloor;
    }

    /**
    * Default constructor.
     * @param targetHost host to connect to
     * @param viaPort connection's port
     */
    public Client(String targetHost, int viaPort){
        this.host = targetHost;
        this.port = viaPort;
        this.setClientRunning(true);
        this.setClientCurrentFloor(-1);
    }

     /**
     * Get the value of currentFloor
     *
     * @return the value of currentFloor
     */
    public int getCurrentFloor() {
        return currentFloor;
    }

    /**
     * Set the value of currentFloor
     *
     * @param currentFloor new value of currentFloor
     */
    public void setCurrentFloor(int currentFloor) {
        this.currentFloor = currentFloor;
    }

    /**
     * @return the desiredFloor
     */
    public int getDesiredFloor() {
        return desiredFloor;
    }
    /**
     * @param desiredFloor the desiredFloor to set
     */
    public void setDesiredFloor(int desiredFloor) {
        this.desiredFloor = desiredFloor;
    }

    /**
     * @return the desiredDirection
     */
    public int getDesiredDirection() {
        return desiredDirection;
    }

    /**
     * @param desiredDirection the desiredDirection to set
     */
    public void setDesiredDirection(int desiredDirection) {
        this.desiredDirection = desiredDirection;
    }

    /**
     * @return the arriveTime
     */
    public long getArriveTime() {
        return arriveTime;
    }

    /**
     * @param arriveTime the arriveTime to set
     */
    public void setArriveTime(long arriveTime) {
        this.arriveTime = arriveTime;
    }

    /**
     * @return the enterTime
     */
    public long getEnterTime() {
        return enterTime;
    }

    /**
     * @param enterTime the enterTime to set
     */
    public void setEnterTime(long enterTime) {
        this.enterTime = enterTime;
    }

    /**
     * @return the state
     */
    public int getState() {
        return state;
    }

    /**
     * @param state the state to set
     */
    public void setState(int state) {
        this.state = state;
    }

    /**
     * @return the port
     */
    public int getPort() {
        return port;
    }

    /**
     * @return the host
     */
    public String getHost() {
        return host;
    }

    /**
     * Get the value of clientRunning
     *
     * @return the value of clientRunning
     */
    public boolean isClientRunning() {
        return clientRunning;
    }

    /**
     * Set the value of clientRunning
     *
     * @param clientRunning new value of clientRunning
     */
    public void setClientRunning(boolean clientRunning) {
        this.clientRunning = clientRunning;
    }

    public boolean isInLift()
    {
        if(this.state == ClientConst.ClientTraveling)
        {
            return true;
        }
        else return false;
    }

    public boolean canIGoOut(){
        if ( this.state == ClientConst.ClientExit )
            return true;
        else return false;
    }

    /**
     * @return the id
     */
    public int getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(int id) {
        this.id = id;
    }

}//end class
